{{- $optim := slice 
    (dict "Process" "resize 16x16 Center webp q75" "descriptor" "16w")
    (dict "Process" "resize 24x24 Center webp q75" "descriptor" "24w")
    (dict "Process" "resize 32x32 Center webp q75" "descriptor" "32w")
-}}
{{- if .Params.authors -}}
    {{- $lang := ( $.Params.lang | default $.Lang ) -}}
    <span class='author'>
        <span class='screen-reader-text'> {{ i18n "by" }} </span>
        {{- range $i, $name := .Params.authors -}}
            {{- if $.Site.Data.authors -}}
                {{- with partial "function/author.html" (dict
                    "name" $name
                    "author" (index $.Site.Data.authors $name)
                    "lang" $lang
                ) -}}
                    {{- if gt $i 0 }}, {{ end -}}
                    <a href='{{ .link | absURL }}'>{{- dict "Width" "16" "Height" "16" "Src" .avatar "Alt" (printf "%v avatar" .name) "OptimConfig" $optim "Class" "tw-inline-block tw-max-h-4 tw-rounded-full tw-translate-y-[-2px] tw-mr-1" | partial "plugin/image.html" -}}{{- .name -}}</a>
                {{- end -}}
            {{- else -}}
                {{- with partial "function/author.html" (dict
                    "name" $name
                    "lang" $lang
                ) -}}
                    {{- if gt $i 0 }}, {{ end -}}
                    <a href='{{ .link | absURL }}'>{{- .name -}}</a>
                {{- end -}}
            {{- end -}}
        {{- end -}}
    </span>
{{- else -}}
    {{- $author := .Params.author | default .Site.Author.name | default (T "author") -}}
    {{- $link := .Params.authorlink | default .Site.Author.link | default .Site.Home.RelPermalink -}}
    {{- $gravatar := 0 -}}
    {{- with .Site.Author.gravataremail -}}
        {{- $gravatar = md5 . | printf "https://www.gravatar.com/avatar/%v?s=240&d=mp" -}}
    {{- end -}}
    {{- $avatar := .Params.authoravatar | default .Site.Author.avatar | default $gravatar | default false -}}
    {{- $options := dict "Class" "author" "Destination" $link "Title" "Author" "Rel" "author" "Content" $author -}}
    {{- if $avatar -}}
        {{- dict "Width" "16" "Height" "16" "Src" $avatar "Alt" (printf "%v avatar" $author) "OptimConfig" $optim "Class" "tw-inline-block tw-max-h-4 tw-rounded-full tw-translate-y-[-2px] tw-mr-1" | partial "plugin/image.html" -}}
    {{- else -}}
        {{- partial "plugin/fontawesome.html" (dict "Style" "solid" "Icon" "user-circle") -}}
    {{- end -}}
    {{- partial "plugin/link.html" $options -}}
{{- end -}}
